// 导入组件，组件必须声明 name
import loading from './Loading.vue'
import { createApp } from 'vue';

export default function Loading(options) {
  // 创建一个节点，并将组件挂载上去
  const mountNode = document.createElement('div')
  document.body.appendChild(mountNode)
  const app = createApp(loading, {
    ...options,
    visible: true, 
    remove() {
      document.body.style.overflow = null;
      app.unmount(mountNode) //创建完后要进行销毁
      document.body.removeChild(mountNode)
    }
  })
  return app.mount(mountNode)
}



